Skip to main content

Packet Header reference

Mmw_output_message_header_t is the header at the beginning of every output packet sent over UART. It contains the packet-level information needed by a receiver to identify and process the packet.

The header is 40 bytes long and contains the following fields in order:

Byte offsetTypeFieldDescription
0–7uint16_t[4]magicWordAn 8-byte sequence used to identify the beginning of a packet.
8–11uint32_tversionVersion number.
12–15uint32_ttotalPacketLenTotal packet length in bytes, including the end padding that rounds the packet length up to a multiple of 32 bytes.
16–19uint32_tplatform
20–23uint32_tframeNumberFrame number for the collection of chirps whose ADC results were used to calculate the detected-object and other output data.
24–27uint32_ttimeCpuCyclesTime, in CPU cycles, at which the packet was created.
28–31uint32_tnumDetectedObjNumber of detected objects. This value is also included in the TLV for detected points, but is repeated in the header for quick access.
32–35uint32_tnumTLVsNumber of TLVs contained in the packet. Use this value to determine how many TLVs to decode.
36–39uint32_tsubFrameNumberSubframe number. This is only relevant when using advanced frame configurations; the default value is 0.

Magic word​

The first 8 bytes of the header form the magic word. It is represented as an array of four 16-bit unsigned integers:

uint16_t magicWord[4] = {0x0102, 0x0304, 0x0506, 0x0708};

Packet length and padding​

totalPacketLen is always a multiple of 32 bytes because padding is appended after the final TLV. The amount of padding is calculated as:

padding = (32 - (unpaddedPacketLen % 32)) % 32
totalPacketLen = unpaddedPacketLen + padding

E.g. a packet containing 100 bytes of header and TLV data receives 28 bytes of padding, giving a totalPacketLen of 128 bytes. If the unpadded packet is already a multiple of 32 bytes, no padding is added.